/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.yuecai.modules.yc_notice.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author yc_notice
* @date 2020-08-24
**/
@Entity
@Data
@Table(name="yc_notice")
public class YcNotice implements Serializable {

    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @Column(name = "title",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "消息标题")
    private String title;

    @Column(name = "image")
    @ApiModelProperty(value = "图片")
    private String image;

    @Column(name = "content",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "内容")
    private String content;

    @Column(name = "del",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否删除 1是 0否")
    private Integer del;

    @Column(name = "create_time",nullable = false)
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "expiration_time",nullable = false)
    @NotNull
    @ApiModelProperty(value = "过期时间")
    private Timestamp expirationTime;

    @Column(name = "notice_type")
    @ApiModelProperty(value = "0群发，1个人")
    private Integer noticeType;

    @Column(name = "user_id")
    @ApiModelProperty(value = "给个人发送时有值")
    private Long userId;

    public void copy(YcNotice source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}